package com.forezp;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//修改了配置文件中的自定义配置后，发送post请求，测试findAll方法，会发现输出依旧，
//
//		可以在controller上添加 @RefreshScope 注解，就能达到自定义配置也能刷新的效果了。

@RestController
@RefreshScope
@SpringBootApplication
@EnableEurekaClient
public class ConfigClientApplication {

	public static void main(String[] args) {
		SpringApplication.run(ConfigClientApplication.class, args);
	}

	@Value("${server.port}")
	String port;
	@Value("${deadTime}")
	String deadTime;

	@RequestMapping(value = "/port")
	public String port() {
		return port;
	}
	@RequestMapping(value = "/deadTime")
	public String deadTime() {
		return deadTime;
	}
}

